<html lang="en">

<head>
    <meta http-equiv="Content-Type"content="text/html;charset=utf-8">
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>星星特效html版本</title>
    <style>
        body {
            background: radial-gradient(200% 100% at bottom center, #f7f7b6, #e96f92, #75517d, #1b2947);
            background: radial-gradient(220% 105% at top center, #1b2947 10%, #75517d 40%, #e96f92 65%, #f7f7b6);
            background-attachment: fixed;
        }

        @keyframes rotate {
            0% {
                transform: perspective(400px) rotateZ(20deg) rotateX(-40deg) rotateY(0);
            }

            100% {
                transform: perspective(400px) rotateZ(20deg) rotateX(-40deg) rotateY(-360deg);
            }
        }
form {
    margin-left:auto;
    margin-right:auto;
    width: 343px;
    height: 333px;
    padding:30px;
    border: 1px solid rgba(0,0,0,.2);
    -moz-border-radius: 5px;
    -webkit-border-radius: 5px;
    border-radius: 5px;
    -moz-background-clip: padding;
    -webkit-background-clip: padding-box;
    background-clip: padding-box;
    background: rgba(0, 0, 0, 0.5); 
    -moz-box-shadow: 0 0 13px 3px rgba(0,0,0,.5);
    -webkit-box-shadow: 0 0 13px 3px rgba(0,0,0,.5);
    box-shadow: 0 0 13px 3px rgba(0,0,0,.5);
    overflow: hidden; 
}
	
	textarea{
		  background: rgba(255, 255, 255, 0.4)  no-repeat scroll 16px 16px; 
	    width: 276px;
	    height: 110px;
	    border: 1px solid rgba(255,255,255,.6);
	    -moz-border-radius: 4px;
	    -webkit-border-radius: 4px;
	    border-radius: 4px;
	    -moz-background-clip: padding;
	    -webkit-background-clip: padding-box;
	    background-clip: padding-box; 
	    display:block;
	    font-family: 'Source Sans Pro', sans-serif;
	    font-size:18px;
	    color:#fff;
	    padding-left:45px;
	    padding-right:20px;
	    padding-top:12px;
	    margin-bottom:20px;
	    overflow:hidden;
	}
	
	input {
	    width: 276px;
	    height: 48px;
	    border: 1px solid rgba(255,255,255,.4);
	    -moz-border-radius: 4px;
	    -webkit-border-radius: 4px;
	    border-radius: 4px;
	    -moz-background-clip: padding;
	    -webkit-background-clip: padding-box;
	    background-clip: padding-box; 
	    display:block;
	    font-family: 'Source Sans Pro', sans-serif;
	    font-size:18px;
	    color:#000000;
	    padding-left:20px;
	    padding-right:20px;
	    margin-bottom:20px;
	}
        #stars {
            transform: perspective(500px);
            transform-style: preserve-3d;
            position: fixed;
            perspective-origin: 50% 100%;
            left: 50%;
            animation: rotate 66s infinite linear;
            bottom: 0;
            z-index: -99;
        }

        .star {
            width: 2px;
            height: 2px;
            background: #f7f7b8;
            position: fixed;
            top: 0px;
            left: 0;
            backface-visibility: hidden;
        }
		
		</style>
</head>

<body>
    <!-- 星星特效 -->
    <div id="stars">
    </div>
	<!-- <div style="position: absolute;
				top: 50%;
				left: 50%;
				height: 30%;
				width: 50%;
				margin: -15% 0 0 -25%;">
	<form >
		<div>
		    <label></label>		
		    <center><input id="t1" type="text"  placeholder="请输入第一个物体"></center>
		</div>
		
	    <div >
	        <label></label>
	    <center><input id="t2" type="text"placeholder="请输入第二个物体"></center>
	    </div>
		
	    <div >
	        <label></label>
	        <center><input id="t3" type="text"placeholder="请输入第三个物体"></center>
	    </div>
		
	    <div >
	        <center><button type="button"  id="check">确认</button>
	        <button type="button"  >作弊</button></center>
	    </div>	
	</form>
	</div> -->
    <script>
        (function () {
            let starsCount = 800; //星星数量
            let distance = 800;//间距
            let parentStarts = document.getElementById("stars");
            for (let i = 0; i < starsCount; i++) {
                let childStart = document.createElement("div");
                childStart.setAttribute("class", 'star');
                parentStarts.appendChild(childStart);
            }
            for (let i = 0; i < starsCount; i++) {
                let item = parentStarts.children[i];
                let speed = 0.2 + (Math.random() * 1);
                let thisDistance = distance + (Math.random() * 300);
                console.log(parentStarts);
                item.style.transformOrigin = "0 0 " + thisDistance + "px";
                item.style.transform = "translate3d(0,0,-" + thisDistance + "px) rotateY(" + (Math.random() * 360) + "deg) rotateX(" + (Math.random() * -50) + "deg) scale(" + speed + "," + speed + ")";
            }
        })();
    </script>
</body>

</html>